using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Google.Protobuf;

public class PacketId
{
	//请求登录验证
	public const int REQ_LOGIN_AUTH_PACKET = 201;
	//返回登录验证
	public const int RESP_LOGIN_AUTH_PACKET = 202;
	//请求创建角色
	public const int REQ_CREATE_ROLE_PACKET = 203;
	//返回创建角色
	public const int RESP_CREATE_ROLE_PACKET = 204;
	//请求登录角色
	public const int REQ_LOGIN_PACKET = 205;
	//返回登录角色
	public const int RESP_LOGIN_PACKET = 206;
	//请求查看玩家信息
	public const int REQ_QUERY_PLAYER_INFO = 207;
	//返回查看玩家信息
	public const int RESP_QUERY_PLAYER_INFO = 208;
	//提示信息
	public const int RESP_TIP = 209;
	//请求心跳
	public const int REQ_HEAT_BEAT = 210;
	//返回心跳
	public const int RESP_HEAT_BEAT = 211;
	//推送属性更新
	public const int RESP_ATTR_UPDATE = 212;
	//推送经验更新
	public const int RESP_EXP_UPDATE = 213;
	//推送血量更新
	public const int RESP_HP_UPDATE = 214;
	//推送货币信息
	public const int RESP_CURRENCY_INFO = 215;
	//请求使用gm命令
	public const int REQ_USE_GM = 301;
	//返回使用gm命令
	public const int RESP_USE_GM = 302;
	//请求移动
	public const int REQ_MOVE = 403;
	//玩家移动
	public const int RESP_PLAYER_MOVE = 404;
	//实体出现
	public const int RESP_ENTITY_APPEAR = 405;
	//移除
	public const int RESP_PLAYER_REMOVE = 406;
	//请求加载地图数据
	public const int REQ_LOAD_MAP = 407;
	//返回加载地图数据
	public const int RESP_LOAD_MAP = 408;
	//请求跳跃
	public const int REQ_JUMP = 409;
	//玩家跳跃
	public const int RESP_JUM = 410;
	//请求攻击
	public const int REQ_ATTACK = 411;
	//玩家攻击
	public const int RESP_ATTACK = 412;
	//请求攻击命中
	public const int REQ_ATTACK_HIT = 413;
	//玩家攻击命中
	public const int RESP_ATTACK_HIT = 414;
	//更新怪物信息
	public const int RESP_MONSTER_INFO = 415;
	//怪物攻击
	public const int RESP_MONSTER_ATTACK = 416;
	//请求切换地图
	public const int REQ_CHANGE_MAP = 417;
	//返回切换场景
	public const int RESP_CHANGE_MAP = 418;
	//请求拾取
	public const int REQ_PICK_UP = 419;
	//返回拾取
	public const int RESP_PICK_UP = 420;
	//背包信息
	public const int RESP_BACKPACK_INFO = 501;
	//请求使用道具
	public const int REQ_BACKPACK_USE_GOODS = 502;
	//RESP_BACKPACK_ADD_ITEM
	public const int RESP_BACKPACK_USE_GOODS = 503;
	//请求整理背包
	public const int REQ_BACKPACK_ORGANIZE = 504;
	//返回整理背包
	public const int RESP_BACKPACK_ORGANIZE = 505;
	//RESP_BACKPACK_ADD_ITEM
	public const int RESP_BACKPACK_ADD_ITEM = 506;
	//RESP_BACKPACK_REMOVE_ITEM
	public const int RESP_BACKPACK_REMOVE_ITEM = 507;
	//RESP_BACKPACK_UPDATE_ITEM
	public const int RESP_BACKPACK_UPDATE_ITEM = 508;
	//请求排行榜列表
	public const int REQ_RANK_LIST = 601;
	//返回排行榜列表
	public const int RESP_RANK_LIST = 602;
	static PacketId()	{
		init();
	}

	public static readonly Dictionary<int, MessageParser> parsers = new Dictionary<int, MessageParser>();
	public static void init()
	{
		Register<Com.Sparrow.ExampleMessage.Proto.ReqLoginAuthPacket>(PacketId.REQ_LOGIN_AUTH_PACKET);
		Register<Com.Sparrow.ExampleMessage.Proto.RespLoginAuthPacket>(PacketId.RESP_LOGIN_AUTH_PACKET);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqCreatePacket>(PacketId.REQ_CREATE_ROLE_PACKET);
		Register<Com.Sparrow.ExampleMessage.Proto.RespCreatePacket>(PacketId.RESP_CREATE_ROLE_PACKET);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqLoginPacket>(PacketId.REQ_LOGIN_PACKET);
		Register<Com.Sparrow.ExampleMessage.Proto.RespLoginPacket>(PacketId.RESP_LOGIN_PACKET);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqQueryPlayerInfoPacket>(PacketId.REQ_QUERY_PLAYER_INFO);
		Register<Com.Sparrow.ExampleMessage.Proto.RespQueryPlayerInfoPacket>(PacketId.RESP_QUERY_PLAYER_INFO);
		Register<Com.Sparrow.ExampleMessage.Proto.RespTipPacket>(PacketId.RESP_TIP);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqHeatBeatPacket>(PacketId.REQ_HEAT_BEAT);
		Register<Com.Sparrow.ExampleMessage.Proto.RespHeatBeatPacket>(PacketId.RESP_HEAT_BEAT);
		Register<Com.Sparrow.ExampleMessage.Proto.RespAttrUpdatePacket>(PacketId.RESP_ATTR_UPDATE);
		Register<Com.Sparrow.ExampleMessage.Proto.RespExpUpdatePacket>(PacketId.RESP_EXP_UPDATE);
		Register<Com.Sparrow.ExampleMessage.Proto.RespHpUpdatePacket>(PacketId.RESP_HP_UPDATE);
		Register<Com.Sparrow.ExampleMessage.Proto.RespCurrencyInfoPacket>(PacketId.RESP_CURRENCY_INFO);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqUseGMPacket>(PacketId.REQ_USE_GM);
		Register<Com.Sparrow.ExampleMessage.Proto.RespUseGMPacket>(PacketId.RESP_USE_GM);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqMovePacket>(PacketId.REQ_MOVE);
		Register<Com.Sparrow.ExampleMessage.Proto.RespPlayerMovePacket>(PacketId.RESP_PLAYER_MOVE);
		Register<Com.Sparrow.ExampleMessage.Proto.RespEntityAppearPacket>(PacketId.RESP_ENTITY_APPEAR);
		Register<Com.Sparrow.ExampleMessage.Proto.RespPlayerRemovePacket>(PacketId.RESP_PLAYER_REMOVE);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqLoadMapPacket>(PacketId.REQ_LOAD_MAP);
		Register<Com.Sparrow.ExampleMessage.Proto.RespLoadMapPacket>(PacketId.RESP_LOAD_MAP);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqJumpPacket>(PacketId.REQ_JUMP);
		Register<Com.Sparrow.ExampleMessage.Proto.RespJumpPacket>(PacketId.RESP_JUM);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqAttackPacket>(PacketId.REQ_ATTACK);
		Register<Com.Sparrow.ExampleMessage.Proto.RespAttackPacket>(PacketId.RESP_ATTACK);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqAttackHitPacket>(PacketId.REQ_ATTACK_HIT);
		Register<Com.Sparrow.ExampleMessage.Proto.RespAttackHitPacket>(PacketId.RESP_ATTACK_HIT);
		Register<Com.Sparrow.ExampleMessage.Proto.RespMonsterInfoacket>(PacketId.RESP_MONSTER_INFO);
		Register<Com.Sparrow.ExampleMessage.Proto.RespMonsterAttackPacket>(PacketId.RESP_MONSTER_ATTACK);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqChangeMapPacket>(PacketId.REQ_CHANGE_MAP);
		Register<Com.Sparrow.ExampleMessage.Proto.RespChangeMapPacket>(PacketId.RESP_CHANGE_MAP);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqPickUpPacket>(PacketId.REQ_PICK_UP);
		Register<Com.Sparrow.ExampleMessage.Proto.RespPickUpPacket>(PacketId.RESP_PICK_UP);
		Register<Com.Sparrow.ExampleMessage.Proto.RespBackPackInfo>(PacketId.RESP_BACKPACK_INFO);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqBackPackUseGoods>(PacketId.REQ_BACKPACK_USE_GOODS);
		Register<Com.Sparrow.ExampleMessage.Proto.RespBackPackUseGoods>(PacketId.RESP_BACKPACK_USE_GOODS);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqBackPackOrganize>(PacketId.REQ_BACKPACK_ORGANIZE);
		Register<Com.Sparrow.ExampleMessage.Proto.RespBackPackOrganize>(PacketId.RESP_BACKPACK_ORGANIZE);
		Register<Com.Sparrow.ExampleMessage.Proto.RespBackPackAddItem>(PacketId.RESP_BACKPACK_ADD_ITEM);
		Register<Com.Sparrow.ExampleMessage.Proto.RespBackPackRemoveItem>(PacketId.RESP_BACKPACK_REMOVE_ITEM);
		Register<Com.Sparrow.ExampleMessage.Proto.RespBackPackUpdateItem>(PacketId.RESP_BACKPACK_UPDATE_ITEM);
		Register<Com.Sparrow.ExampleMessage.Proto.ReqRankList>(PacketId.REQ_RANK_LIST);
		Register<Com.Sparrow.ExampleMessage.Proto.RespRankList>(PacketId.RESP_RANK_LIST);
	}
	public static void Register<T>(int msgId) where T : IMessage<T>, new()
	{
		parsers[msgId] = new MessageParser<T>(() => new T());
	}
}